<?php
namespace app\sadmin\controller;
use think\Controller;
use think\Db;

class Manageuser extends Controller
{
   public function index(){
        $user=Db::name("user")->select();
        // dump($shop);exit;
        $this->assign("user",$user);

        return $this->fetch();
       }

        

       public function  close($userid){
       $result=Db::name("user")->where("userid='$userid'")->find();

       if ($result['state']==0)
       {
           $state1=1;
       }
       else{
           $state1=0;
       }
       $res=Db::name("user")->where("userid='$userid'")->update(['state'=>$state1]);
        if($res){
            $this->success("成功");
        }else{
            $this->error("失败");
        }
    }


      public function edit($userid){
       $result=Db::name("user")->where("userid='$userid'")->find();
       $res=Db::name("user")->where("userid='$userid'")->update(['password'=>md5(123)]);
        if($res){
            $this->success("成功");
        }else{
            $this->error("失败");
        }


   
}


}